#!/bin/bash

script_start()
{
	if [ -x /etc/alerter/new_test.pl ]; 
	  then
	  	/etc/alerter/new_test.pl || exit 0;
		echo "######## This script successfully started ########";
	  else
	  	echo "####### This script not started ######## ";
					
	fi
}

script_stop()
{
	kill_pid=`cat '/etc/alerter/.scripte.pid'`;
	echo $kill_pid;
	kill -s SIGTERM $kill_pid;
	echo "######## This script successfully stoped ######## ";
}

script_restart()
{
	script_stop;
	sleep 1;
	script_start;
}

case "$1" in
	'start')	
		script_start
	;;
	'stop')
		script_stop
	;;
	'restart')
		script_restart
	;;
	*)	echo "usage $0 {start|stop|restart}";
		exit 1;
	;;
esac
